const http = require('../utils/http.js');

// 商品分类
const goodsType = () => {
    return http.request('GET', '/Goods/category')
}

// 商品分类，分页查询
const goodsTypePage = (data) => {
    return http.request('POST', `/Goods/category/page`, data)
}

// 分页查询 商品信息
const getGoodsPages = (data) => {
    return http.request('POST', `/Goods/page`, data)
}

// 获取商品详情
const goodsDetail = (params) => {
    return http.request('GET', `/Goods/detail/${params.id}?invitationId=${params.invitationId}`)
}

// 根据id查询商品分类
const goodsTypeById = (id) => {
    return http.request('GET', `/Goods/category/${id}`)
}

// 获取拼团商品
const getGroupList = (data) => {
    return http.request('POST', `/GoodsSpellGroup/page`, data)
}

// 根据商品id获取正在拼团的列表
const getGroupingList = (id)=>{
    return http.request('GET', `/GoodsSpellGroup/${id}/record?status=2`)
}

// 获取我的库存-库存
const getMyStockGoods = (data)=>{
    return http.request('POST', `/AgentWarehouse/current/page`,data)
}

module.exports = {
    goodsType,
    getGoodsPages,
    goodsDetail,
    goodsTypePage,
    goodsTypeById,
    getGroupList,
    getGroupingList,
    getMyStockGoods
}